import { createApp } from 'vue'
import ElementPlus from 'element-plus';
import router from './router'
import store from './store'
import Banner from '@/components/Banner/index.vue'
import Pagination from '@/components/Pagination/index.vue'

import 'animate.css';

import '@/router/premisstion' // 引入路由鉴权
import 'element-plus/dist/index.css' // 引入element-plus的样式
import * as ElementPlusIconsVue from '@element-plus/icons-vue' //引入element-plus的所有图标
import '@/styles/index.scss' // 默认样式
import 'bootstrap/dist/css/bootstrap.css' // 引入bootstrap

// 确保在上线时也能获取mock数据
import { setupProdMockServer } from './utils/mockProdServer';
setupProdMockServer();

//@ts-ignore 忽略当前文件ts类型的检测否则有红色提示(打包会失败)
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

import App from './App.vue'

const app = createApp(App)
app.use(router)
app.use(store)
app.component("Banner", Banner) // 将banner组件注册为全局组件
app.component("Pagination", Pagination) // 将Pagination组件注册为全局组件

app.use(ElementPlus, {
    size: 'small',
    zIndex: 3000,
    locale: zhCn
})
// 对所有图标进行注册，可以直接当做全局组件进行使用
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.mount('#app')